package com.qf.flash.ui.chat.rowProvider;

import android.content.Context;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.easeui.EaseConstant;
import com.hyphenate.easeui.widget.chatrow.EaseChatRowText;
import com.hyphenate.exceptions.HyphenateException;
import com.qf.flash.R;

/**
 * 描述:
 * 2020/5/6 16:20
 */
public class EaseChatImgTextExpression extends EaseChatRowText {
    private ImageView imageView;
    public EaseChatImgTextExpression(Context context, EMMessage message, int position, BaseAdapter adapter) {
        super(context, message, position, adapter);
    }


    @Override
    protected void onInflateView() {
        inflater.inflate(message.direct() == EMMessage.Direct.RECEIVE ?
                R.layout.ease_row_receive_img_textexpression : R.layout.ease_row_sent_img_textexpression, this);
    }



    @Override
    protected void onFindViewById() {
        super.onFindViewById();
        imageView = (ImageView) findViewById(R.id.iv_img);
    }

    @Override
    public void onSetUpView() {
        super.onSetUpView();
        try {
            String chat_invite_picture = message.getStringAttribute(EaseConstant.CHAT_INVITE_PICTURE);
            Glide.with(activity).load(chat_invite_picture)
                    .into(imageView);
        } catch (HyphenateException e) {
            e.printStackTrace();
        }
    }

//    @Override
//    public void onSetUpView(EMMessage msg) {
//
//
//    }
}
